package trader.orig;

public class OwnedInstrument extends Instrument {
    private int volume;
    private double buy;
    private final String internalId;
    //private double diff;
    
    public OwnedInstrument(String symbol, String id, String internalId) {
        super(symbol, id);
        this.internalId = internalId;
    }
    
    public synchronized int getVolume() {
        return volume;
    }
    
    public synchronized void setVolume(int volume) {
        this.volume = volume;
    }
    
    public synchronized void setBuy(double buy) {
        this.buy = buy;
    }
    
    //public void setDiff(double diff) {
    //    this.diff = diff;
    //}
    
    public synchronized double getBuy() {
        return buy;
    }
    
    public synchronized double getValue() {
        return buy * volume;
    }
    
    //public double getDiff() {
    //    return diff;
    //}
    
    public String internalId() {
        return internalId;
    }

    
    @Override
    public synchronized String toString() {
        return id + " :: " + symbol + ": vol=" + volume + ", buy=" + buy + ", value=" + getValue();
    }
}
